<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width= , initial-scale=1.0">
    <title>Document</title>
</head>
<script src="../js/vue.js"></script>
<body>
    <div id="app">   
        <cpn></cpn>   
       <cpn>
           <!-- 目的是获取子组件中的pLanguages -->
        <template slot-scope="slot">
            <span>{{slot.data.join(' * ')}}</span>
        </template>
       </cpn>  
       <cpn>
        <template slot-scope="slot">
            <span>{{slot.data.join(' - ')}}</span>
        </template>
       </cpn>   
    </div>
    
    <template id="cpn">
        <div>
          <h2>我是子组件</h2>
          <slot :data="pLanguages">
              <ul>
                  <li v-for="item in pLanguages">{{item}}</li>
              </ul>
          </slot>
        </div>
      </template>
    <script>
       
        const app = new Vue({
            el: '#app',    
            data: {    
            },
            methods: {
                btnClick() {
                    
                }
            },
            components: {
                cpn: {
                    template: "#cpn",
                    data () {
                        return {
                            pLanguages: ['javaScript','java','Python']
                        }
                    }
                }
            }
            


        })
        
        

    </script>

    <h2>插槽的作用域</h2>
    <img src="../img/编译作用域.png" alt="">
</body>
</html>